package FactoryMethod.Factory;

import FactoryMethod.cashier.Cashier;
import FactoryMethod.cashier.NormalCashier;
import FactoryMethod.cashier.RebateCashier;
import FactoryMethod.cashier.ReduceCashier;

/**
 * @author duanzhizhou
 * @date 2024/9/30
 */
public class ReturnThenRebateFactory implements IFactory{
    private final double discount;
    private final double condition;
    private final double returnMoney;
    
    public ReturnThenRebateFactory(double discount, double condition, double returnMoney) {
        this.discount = discount;
        this.condition = condition;
        this.returnMoney = returnMoney;
    }
    
    
    @Override
    public Cashier create() {
        Cashier cashier = new NormalCashier();
        cashier = new ReduceCashier(cashier, condition, returnMoney);
        return new RebateCashier(cashier, discount);
    }
}
